<%@page import="java.util.Iterator"%>
<%@page import="org.gpf.factory.DAOFactory"%>
<%@page import="org.gpf.vo.User"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html; charset=utf-8"%>
<%
	request.setCharacterEncoding("utf-8");
	
	String keyword = request.getParameter("kw");
	if(keyword == null){
		keyword = ""; // 如果没有查询关键字则查询全部
	}
	List<User> users = DAOFactory.getIUserDAOInstance().findAll(keyword);
	Iterator <User> iterator = users.iterator();
%>
<center>
<h1>雇员信息如下</h1>
<form action="user_list.jsp" method="post">
	请输入查询关键字:<input type="text" name = "kw">
	<input type="submit" value="查询">
</form>
<table border="1">
  <tr>
    <th>雇员编号</th>
    <th>雇员姓名</th>
    <th>雇员密码</th>
    <th>雇员性别</th>
    <th>雇佣年龄</th>
    <th>雇员生日</th>
  </tr>
<%
	while(iterator.hasNext()){
		User user = iterator.next();
%>
	<tr>
	    <td><%=user.getId() %></td>
	    <td><%=user.getUsername() %></td>
	    <td><%=user.getPassword() %></td>
	    <td><%=user.getSex() %></td>
	    <td><%=user.getAge() %></td>
	    <td><%=user.getBirthday() %></td>
  	</tr>
<%	
	}
%>

</table>
</center>